package office.dao.business;

import java.util.Iterator;
import java.util.Map;

import platform.common.dao.impl.BaseDomainProviderImpl;

public class BidBookDP extends BaseDomainProviderImpl{
	
	//方法描述: 根据项目名称获取标书信息
	public String findBidBookByIdAndName(Map condMap){
		StringBuffer strBuf = new StringBuffer();
		strBuf.append(" from "+ this.getDomainClassName() + " where 1=1 ");
		Iterator it = condMap.keySet().iterator();
		while(it.hasNext()){
			String str = (String)it.next();
			if(str.equals("projectName")){
				strBuf.append(" and projectName like '%"+condMap.get(str)+"%' ");
			}
			if(str.equals("biddingUnit")){
				strBuf.append(" and biddingUnit like '%"+condMap.get(str)+"%' ");
			}
			if(str.equals("productName")){
				strBuf.append(" and productName like '%"+condMap.get(str)+"%' ");
			}
			if(str.equals("biddingTime")){
				strBuf.append(" and biddingTime = to_date('"+condMap.get(str)+"','yyyy-mm-dd' )");
			}
			
			if(str.equals("applyMan")){
				strBuf.append(" and ( applyMan = '"+condMap.get(str)+"' or  " +
						"salesMan ='"+condMap.get(str)+"' or checkUserFee='"+condMap.get(str)+"' or" +
								" checkUserCw='"+condMap.get(str)+"' )");
			}
		}
		return strBuf.toString();
	}
	//方法描述: 根据标书状态获取标书
	public String findBidBookByStatus(Map condMap){
		StringBuffer strBuf = new StringBuffer();
		strBuf.append(" from "+ this.getDomainClassName() + " where 1=1 ");
		Iterator it = condMap.keySet().iterator();
		while(it.hasNext()){
			String str = (String)it.next();
			if(str.equals("status")){
				strBuf.append(" and status >= '"+condMap.get(str)+"' ");
			}
			if(str.equals("bidStatus")){
				strBuf.append(" and bidStatus >= '"+condMap.get(str)+"' ");
			}
		}
		return strBuf.toString();
	}
	
}
